# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceCompliance do
  @moduledoc """
  Compliance data for an OS policy resource.

  ## Attributes

  *   `complianceState` (*type:* `String.t`, *default:* `nil`) - The compliance state of the resource.
  *   `complianceStateReason` (*type:* `String.t`, *default:* `nil`) - A reason for the resource to be in the given compliance state. This field is always populated when `compliance_state` is `UNKNOWN`. The following values are supported when `compliance_state == UNKNOWN` * `execution-errors`: Errors were encountered by the agent while executing the resource and the compliance state couldn't be determined. * `execution-skipped-by-agent`: Resource execution was skipped by the agent because errors were encountered while executing prior resources in the OS policy. * `os-policy-execution-attempt-failed`: The execution of the OS policy containing this resource failed and the compliance state couldn't be determined. * `os-policy-execution-pending`: OS policy that owns this resource was assigned to the given VM, but was not executed yet.
  *   `configSteps` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceOSPolicyResourceConfigStep.t)`, *default:* `nil`) - Ordered list of configuration completed by the agent for the OS policy resource.
  *   `execResourceOutput` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceExecResourceOutput.t`, *default:* `nil`) - ExecResource specific output.
  *   `osPolicyResourceId` (*type:* `String.t`, *default:* `nil`) - The ID of the OS policy resource.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :complianceState => String.t() | nil,
          :complianceStateReason => String.t() | nil,
          :configSteps =>
            list(
              GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceOSPolicyResourceConfigStep.t()
            )
            | nil,
          :execResourceOutput =>
            GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceExecResourceOutput.t()
            | nil,
          :osPolicyResourceId => String.t() | nil
        }

  field(:complianceState)
  field(:complianceStateReason)

  field(:configSteps,
    as:
      GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceOSPolicyResourceConfigStep,
    type: :list
  )

  field(:execResourceOutput,
    as:
      GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceComplianceExecResourceOutput
  )

  field(:osPolicyResourceId)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceCompliance do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceCompliance.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentReportOSPolicyComplianceOSPolicyResourceCompliance do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
